WebWork 2 : Value Stack Internals
This page last changed on Nov 30, 2004 by jcarreira.
As Matt Ho explained on the mailing list: model and an action as follows: [ model, action ] here's how the following ognl would resolve:[0] - a CompoundRoot object that contains our stack, [model, action] [1] - another CompoundRoot that contains only [action][0].toString() - calls toString() on the first object in the value starting from [OS:action] and excluding the CompoundRoot that supports a getFoo() method I hope this doesn't sound too confusing :\ If you're using Velocity, this can most easily be written as:$stack.findValue("[0]").peek() Unfortunately, <ww:property value="[0].peek()"/> won't work as thiswould translate into "starting at the top of the value stack (and excluding the CompoundRoot), find the first object that has a method called peek()" --------thanks Matt! here is the com.opensymphony.xwork.util.CompoundRoot class which Matt mentions:public class CompoundRoot extends ArrayList { //~ Constructors /////////////////////////////////////////////////////////// public CompoundRoot() { } public CompoundRoot(List list) { super(list); } //~ Methods //////////////////////////////////////////////////////////////// public CompoundRoot cutStack(int index) { return new CompoundRoot(subList(index, size())); } public Object peek() { return get(0); } public Object pop() { return remove(0); } public void push(Object o) { add(0, o); } } What's on the stack?WebWork2 contains the following items by default in the ValueStack:
|
Document generated by Confluence on Dec 14, 2004 16:37 |